package com.nisco.dms.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nisco.dms.service.BaseService;
import com.nisco.dms.util.dwz.AjaxObject;

/*
 *  Copyright : 江苏金恒信息科技有限公司 NISCO
 *  Author : Jiang Bin(860012)
 *  System : 系统说明
 *  Target : 功能说明
 *  Create : 2013-3-12 下午7:55:56
 *  Update : 2013-3-12 下午7:55:56
 */


public abstract class AbstarctCore<T> {
	
	public BaseService<T, Long> baseService;
	public AbstarctCore(){
		System.out.println("1:===========");
//		this.baseService=test();
	}

	@RequiresPermissions("Company:save")
	@RequestMapping(value = "/create", method = RequestMethod.GET)
	public String preCreate() {
		return "company/companyCreate";
	}
	
	@RequiresPermissions("Company:save")
	@RequestMapping(value = "/create", method = RequestMethod.POST)
	public @ResponseBody
	String create(T t, HttpServletRequest request) {
		test().save(t);
		AjaxObject ajaxObject = new AjaxObject(200, "公司添加成功！",
				"moduleListNav_32", "", "", "closeCurrent");
		return ajaxObject.toString();
	}
	
	public abstract BaseService<T, String> test();
}
